package com.tanhua.server.controller;

import com.tanhua.domain.vo.RecommendQueryVo;
import com.tanhua.server.service.TodayBestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/tanhua")
@Slf4j
public class TodayBestController {


    @Autowired
    private TodayBestService todayBestService;

    /**
     *接口名称：今日佳人
     * 接口路径：GET/tanhua/todayBest
     */
    @GetMapping("/todayBest")
    public ResponseEntity todayBest(){
        return todayBestService.queryTodayBest();
    }

    /**
     * 接口名称：推荐朋友 (首页推荐)
     * 接口路径：GET/tanhua/recommendation
     */
    @GetMapping("recommendation")
    public ResponseEntity<Object> recommendation(RecommendQueryVo vo){
        return todayBestService.queryRecommendation(vo);
    }

    /**
     * 接口名称：佳人信息
     * 接口路径：GET/tanhua/:id/personalInfo
     */
    @GetMapping("/{id}/personalInfo")
    public ResponseEntity<Object> queryPersonalInfo(@PathVariable("id") Long recommendUserId){
        return todayBestService.queryPersonalInfo(recommendUserId);
    }

    /**
     * 接口名称：查询陌生人问题
     * 接口路径：GET/tanhua/strangerQuestions
     */
    @GetMapping("/strangerQuestions")
    public ResponseEntity<Object> strangerQuestions(Long userId) {
        return todayBestService.strangerQuestions(userId);
    }


    /**
     *接口名称：回复陌生人问题
     * 接口路径：POST/tanhua/strangerQuestions
     */
    @PostMapping("/strangerQuestions")
    public ResponseEntity<Object> replyQuestions(@RequestBody Map<String,Object> paramMap) {
        Integer userId = (Integer) paramMap.get("userId");
        String reply = (String) paramMap.get("reply");
        return todayBestService.replyQuestions(userId,reply);
    }

    /**
     * 接口名称：搜附近
     * 接口路径：GET/tanhua/search
     */
    @GetMapping("search")
    public ResponseEntity<Object> searchNear(String gender, Long distance){
        return todayBestService.searchNear(gender, distance);
    }
    /**
     * 接口名称：探花-左滑右滑
     * 接口路径：GET/tanhua/cards
     */
    @GetMapping("/cards")
    public ResponseEntity<Object> cards() {

        return todayBestService.cards();
    }
    /**
     接口名称：探花-不喜欢
     删除推荐用户,加入黑名单
     无论是左滑还是右滑，以后都不会出现该用户在卡片数据中
     接口路径：GET/tanhua/:id/unlove
     */
    @GetMapping("/{id}/unlove")
    public ResponseEntity<Object> tanhuaunlove(@PathVariable("id") String id) {

        return todayBestService.tanhuaunlove(id);
    }

    /**
     接口名称：探花-喜欢
     进入我的喜欢或互相喜欢
     接口路径：GET/tanhua/:id/love
     */
    @GetMapping("/{id}/love")
    public ResponseEntity<Object> tanhuaLove(@PathVariable("id") String id) {

        return todayBestService.tanhuaLove(id);
    }
}
